package com.woniuxy.consumer.controller;

import com.woniuxy.commons.entity.PageBean;
import com.woniuxy.commons.entity.UserDetails;
import com.woniuxy.commons.entity.Userinfo;
import com.woniuxy.commons.utils.ResponseResult;
import com.woniuxy.consumer.service.UserinfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author author
 * @create 2021-11-15 10:04
 */
//@CrossOrigin  //解决跨域
@RestController
@RequestMapping("/consumer")
public class UserinfoController {
    @Resource
    private UserinfoService userinfoService;

    @GetMapping("/selectUserdetailsAll")
    public ResponseResult<PageBean<Userinfo>> fenyeUserDetails(
            UserDetails userDetails, int pageSize, int pageIndex
    ){
   return userinfoService.selectUserinfoByPageService(userDetails, pageIndex,pageSize);
    }

//    根据uid删除表中数据
    @DeleteMapping("/deleteUser/{uid}")
    ResponseResult deleteByUid(@PathVariable String uid){
        System.out.println(uid);
        return userinfoService.deleteByUid(uid);

    }


}
